<!DOCTYPE HTML>
<html lang="en">

<head>
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable" content="Hexo">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <meta name="browsermode" content="application">
    <meta name="screen-orientation" content="portrait">
    <meta name="theme-version" content="1.2.3">
    <meta name="root" content="/myblogs/">
    <link rel="dns-prefetch" href="http://thammer.gitee.io/myblogs">
    <!--SEO-->

<meta name="keywords" content="ZigBee" />


<meta name="description" content="ZigBee设备入网流程ZigBee设备入网有关联方式和直接方式两种，我所熟悉的是关联方式，这也是最常用的方式。
关联方式
step1 设备发出Beacon Request
设备会在预先设置的几..." />


<meta name="robots" content="all" />
<meta name="google" content="all" />
<meta name="googlebot" content="all" />
<meta name="verify" content="all" />
    <!--Title-->

<title>
    
    ZigBee设备入网流程 |
    
    Hexo
</title>

<link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">


<link rel="icon" href="/favicon.ico">

    


<link rel="stylesheet" href="/myblogs/css/bootstrap.min.css?rev=3.3.7.css">
<link rel="stylesheet" href="/myblogs/css/font-awesome.min.css?rev=4.7.0.css">
<link rel="stylesheet" href="/myblogs/css/style.css?rev=@@hash.css">

    
<div class="hide">
    <script type="text/javascript">
    var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    document.write(unescape("%3Cspan class='cnzz_stat_icon_1263868967 hide' %3E%3Cscript%20src%3D%22https%3A%2F%2Fs95.cnzz.com%2Fz_stat.php%3Fweb_id%3D1272564536%22%3E%3C%2Fscript%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1263868967%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));
    </script>
</div>




    

<meta name="generator" content="Hexo 4.2.0"></head>
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<div style="ie">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->
<body>
    <header class="main-header"  style="background-image:url(
    http://snippet.shenliyang.com/img/banner.jpg)"
     >
    <div class="main-header-box">
        <a class="header-avatar" href="/" title='John Doe'>
            <img src="/myblogs/img/avatar.jpg" alt="logo头像" class="img-responsive center-block">
        </a>
        <div class="branding">
            <!--<h2 class="text-hide">Snippet主题,从未如此简单有趣</h2>-->
            
            <img src="/myblogs/img/branding.png" alt="Snippet 博客主题" class="img-responsive center-block">
            
        </div>
    </div>
</header>
    <nav class="main-navigation">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="navbar-header"><span class="nav-toggle-button collapsed pull-right" data-toggle="collapse" data-target="#main-menu" id="mnav">
                        <span class="sr-only"></span>
                        <i class="fa fa-bars"></i>
                    </span>
                    <a class="navbar-brand" href="http://thammer.gitee.io/myblogs">
                        Hexo</a>
                </div>
                <div class="collapse navbar-collapse" id="main-menu">
                    <ul class="menu">
                        
                        <li role="presentation" class="text-center">
                            <a href="/"><i class="fa "></i>
                                Home</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/前端/"><i class="fa "></i>
                                前端</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/后端/"><i class="fa "></i>
                                后端</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/工具/"><i class="fa "></i>
                                工具</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/archives/"><i class="fa "></i>
                                时间轴</a>
                        </li>
                        
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
    <section class="content-wrap">
        <div class="container">
            <div class="row">
                <main class="col-md-8 main-content m-post">
                    <p id="process"></p>
<article class="post">
    <div class="post-head">
        <h1 id="ZigBee设备入网流程">
            
            ZigBee设备入网流程
            
        </h1>
        <div class="post-meta">
    
    <span class="categories-meta fa-wrap">
        <i class="fa fa-folder-open-o"></i>
        <a class="category-link" href="/myblogs/categories/ZigBee/">ZigBee</a>
    </span>
    
    
    <span class="fa-wrap">
        <i class="fa fa-tags"></i>
        <span class="tags-meta">
            
            <a class="tag-link" href="/myblogs/tags/ZigBee/" rel="tag">ZigBee</a>
            
        </span>
    </span>
    
    
    
    <span class="fa-wrap">
        <i class="fa fa-clock-o"></i>
        <span class="date-meta">
            2019/08/17</span>
    </span>
    
    
</div>
        
        
    </div>
    
    <div class="post-body post-content">
        <h1 id="ZigBee设备入网流程"><a href="#ZigBee设备入网流程" class="headerlink" title="ZigBee设备入网流程"></a>ZigBee设备入网流程</h1><p>ZigBee设备入网有关联方式和直接方式两种，我所熟悉的是关联方式，这也是最常用的方式。</p>
<h2 id="关联方式"><a href="#关联方式" class="headerlink" title="关联方式"></a>关联方式</h2><p><img src="https://i.imgur.com/rZnatKL.png" alt=""></p>
<h3 id="step1-设备发出Beacon-Request"><a href="#step1-设备发出Beacon-Request" class="headerlink" title="step1 设备发出Beacon Request"></a>step1 设备发出Beacon Request</h3><p><img src="https://i.imgur.com/hoXLfvg.png" alt=""></p>
<p>设备会在预先设置的几个信道里面按照指定的顺序逐信道发出这个包，看到Dest PAN ID,Dest Address都是0xFFFF，说明这是个广播包，在这些信道里面的网络都会收到它。</p>
<h3 id="step2-route节点发出Beacon回复"><a href="#step2-route节点发出Beacon回复" class="headerlink" title="step2 route节点发出Beacon回复"></a>step2 route节点发出Beacon回复</h3><p><img src="https://i.imgur.com/kEqVwnU.png" alt=""><br>这个回复里面有五个关键的值</p>
<ul>
<li>Source PAN ID    ：回复Beacon的这个设备所处网络的PAN ID</li>
<li>Source Address：回复Beacon的这个设备所处网络的短地址</li>
<li>Association Permit：关联许可是否开放</li>
<li>Router Capacity：可否接入Route节点</li>
<li>End Device Capacity：可否接入End Device</li>
</ul>
<p>能收到入网设备发出的<code>Beacon Request</code>的网络都会回复<code>Beacon</code>，并且同一个网络里面能收到入网设备<code>Beacon Request</code>的FFD设备都会回复<code>Beacon</code>。这样一来，一般入网设备会受到多个<code>Beacon</code>回复。那么它会按照下列的顺序，并且结合这帧Beacon的Link Quality来进行下一步动作：</p>
<ol>
<li>入网设备首先判断<code>Association Permit</code>是否开放，这个是需要协调器发出全网广播，通知所有route节点这个许可开放了。</li>
<li>如果关联许可是开放的，再根据自己所属的设备类型来判断<code>Router Capacity</code>、 <code>End Device Capacity</code>。</li>
<li>如果可以接入，再筛选最佳Link Quality的设备发出<code>Association Request</code>，这个时候就需要用Beacon里面的Source PAN ID和Source Address发出一个MAC层的单播包。</li>
</ol>
<h3 id="step3-设备发出Association-Request"><a href="#step3-设备发出Association-Request" class="headerlink" title="step3 设备发出Association Request"></a>step3 设备发出Association Request</h3><p><img src="https://i.imgur.com/Nw7m6Gl.png" alt=""></p>
<h3 id="step4-route发出Association-Response"><a href="#step4-route发出Association-Response" class="headerlink" title="step4 route发出Association Response"></a>step4 route发出Association Response</h3><p><img src="https://i.imgur.com/5vfZ0WG.png" alt=""></p>
<h3 id="step5-秘钥传输"><a href="#step5-秘钥传输" class="headerlink" title="step5 秘钥传输"></a>step5 秘钥传输</h3><p><img src="https://i.imgur.com/ofLqdx5.png" alt=""></p>
<h2 id="step6-Device-Announce"><a href="#step6-Device-Announce" class="headerlink" title="step6 Device Announce"></a>step6 Device Announce</h2><p>Device Announce的广播数据主要是通知全网相关节点有一个新设备进来了，给大家做个自我介绍，大家刷新下路由表这类的信息。并且可以看到此时的数据在NWK层加密了，就是用了上面的Transport Key传输的Standard Network Key。<br><img src="https://i.imgur.com/RN3YD5p.png" alt=""></p>

    </div>
    
    <div class="post-footer">
        <div>
            
            转载声明：
            商业转载请联系作者获得授权,非商业转载请注明出处 © <a href="" target="_blank">Snippet</a>
            
            
        </div>
        <div>
            
        </div>
    </div>
</article>
<div class="article-nav prev-next-wrap clearfix">
    
    
    <a href="/myblogs/2019/08/13/SPI%E4%BB%8B%E7%BB%8D/" class="next-post btn btn-default" title='SPI接口介绍'>
        <span class="hidden-lg">下一篇</span>
        <span class="hidden-xs">
            SPI接口介绍</span><i class="fa fa-angle-right fa-fw"></i>
    </a>
    
</div>

<div id="comments">
    

<div id="vcomments" class="valine"></div>

<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="/myblogs/assets/valine.min.js"></script>

<script>
new Valine({
    av: AV,
    el: '#vcomments',
    appId: 'xOKV9J4UeQAtVkvnJC7Kq2Jn-gzGzoHsz',
    appKey: 'erIpQac4azoCmgfBB7Dl9maa',
    placeholder: '说点什么吧',
    notify: false,
    verify: true,
    avatar: 'mm',
    meta: 'nick,mail'.split(','),
    pageSize: '10',
    path: window.location.pathname,
    lang: 'en'.toLowerCase()
})
</script>


</div>

                </main>
                
                    <aside id="article-toc" role="navigation" class="col-md-4">
    <div class="widget">
        <h3 class="title">
            Table of Contents
        </h3>
        
        <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#ZigBee设备入网流程"><span class="toc-text">ZigBee设备入网流程</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#关联方式"><span class="toc-text">关联方式</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#step1-设备发出Beacon-Request"><span class="toc-text">step1 设备发出Beacon Request</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#step2-route节点发出Beacon回复"><span class="toc-text">step2 route节点发出Beacon回复</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#step3-设备发出Association-Request"><span class="toc-text">step3 设备发出Association Request</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#step4-route发出Association-Response"><span class="toc-text">step4 route发出Association Response</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#step5-秘钥传输"><span class="toc-text">step5 秘钥传输</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#step6-Device-Announce"><span class="toc-text">step6 Device Announce</span></a></li></ol></li></ol>
        
    </div>
</aside>
                
            </div>
        </div>
    </section>
    <footer class="main-footer">
    <div class="container">
        <div class="row">
        </div>
    </div>
</footer>
<a id="back-to-top" class="icon-btn hide">
    <i class="fa fa-chevron-up"></i>
</a>
    <div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="busuanzi">
    
</div>
            </div>
            <div class="col-sm-12">
                <span>Copyright &copy;
                    2017
                    
                </span> |
                <span>
                    Powered by <a href="//hexo.io" class="copyright-links" target="_blank" rel="nofollow">Hexo</a>
                </span> |
                <span>
                    Theme by <a href="//github.com/shenliyang/hexo-theme-snippet.git" class="copyright-links" target="_blank" rel="nofollow">Snippet</a>
                </span>
            </div>
        </div>
    </div>
</div>




<script src="/myblogs/js/app.js?rev=@@hash.js"></script>

</body>
</html>